﻿// JScript 文件

jQuery(function ($) {
    $(".wrapper").each(function () {
        var chd = $(this).children();
        var w = chd.outerWidth();
        var h = chd.outerHeight();
        chd.before("<div class='shadow'></div>");
        $(this).width(w + 3).height(h + 3);
        chd.prev(".shadow").width(w).height(h);
    });
});

function toggleExpand(content) {

    if (content.style.display == "none") {
        content.style.display = "block";
    }
    else {
        content.style.display = "none";
    }
}
function CloseElement(content) {

    var tab = document.getElementById('tb1');
    content.style.display = "none";
    for (var i = 0; i < tab.rows.length; i++) {
        var count = tab.rows[i].childNodes.length; 
        for (var j = 1; j < count-1; j++) {

            tab.rows[i].removeChild(tab.rows[i].childNodes[2]);
        }
    }
}

function ShowResult(content) {

    var d = document.getElementById('Result');
//    d.style.left = document.body.scrollLeft + event.clientX - 50;
//    d.style.top = document.body.scrollTop + event.clientY + 10;
    d.style.left = (event.clientX - 50).toString() + "px";
    d.style.top = (event.clientY + 10).toString() + "px";
    
    //var str = content.value;
    var str = content.getAttribute("value")
    if (str) {
        var tab = document.getElementById('tb1');
        var obje = eval(str);

        for (var i = 0; i < obje.length; i++) {
            //if (tab.rows[0].cells.length === 0)
            //{
            //    var c01 = tab.rows[0].insertCell(0);
            //    var c11 = tab.rows[1].insertCell(0);
            //    var c21 = tab.rows[2].insertCell(0);
            //    var c31 = tab.rows[3].insertCell(0);
            //    var c41 = tab.rows[4].insertCell(0);
            //    var c51 = tab.rows[5].insertCell(0);
            //    c01.innerText = "审批人";
            //    c01.className = obje[i].className;
            //    c11.innerText = "审批结果";
            //    c11.className = obje[i].className;
            //    c21.innerText = "审批意见";
            //    c21.className = obje[i].className;
            //    c31.innerText = "审批时间";
            //    c31.className = obje[i].className;
            //    c41.innerText = "所在部门";
            //    c41.className = obje[i].className;
            //    c51.innerText = "联系电话";
            //    c51.className = obje[i].className;
            //}
            var c0, c1, c2, c3, c4, c5;
            c0 = tab.rows[0].insertCell(i + 1);
            c1 = tab.rows[1].insertCell(i + 1);
            c2 = tab.rows[2].insertCell(i + 1);
            c3 = tab.rows[3].insertCell(i + 1);
            c4 = tab.rows[4].insertCell(i + 1);
            c5 = tab.rows[5].insertCell(i + 1);

            c0.innerText = obje[i].operater;
            c0.className = obje[i].className;
            c1.innerText = obje[i].result;
            c1.className = obje[i].className;
            c2.innerText = obje[i].message;
            c2.className = obje[i].className;
            c3.innerText = obje[i].time;
            c3.className = obje[i].className;
            c4.innerText = obje[i].depart;
            c4.className = obje[i].className;
            c5.innerText = obje[i].mobile;
            c5.className = obje[i].className;


        }
        d.style.display = 'block';
    }




}


      